package smartcrud.spring.models.rbac;

import java.io.Serializable;

/**
 * 
 * 
 */
public class Menu implements Serializable {
	private Long id;//
	private Integer level = 1;//
	private String name;//
	private Integer menuOrder;//
	private String url;//
	private Long pid;//
	private String comment;//

	public Menu() {
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getId() {
		return this.id;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getLevel() {
		return this.level;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}
	
	public String getDisplayName(){
		return (level==2?"----":"") + getName(); 
	}

	public void setMenuOrder(Integer menuOrder) {
		this.menuOrder = menuOrder;
	}

	public Integer getMenuOrder() {
		return this.menuOrder;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrl() {
		return this.url;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	public Long getPid() {
		return this.pid;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getComment() {
		return this.comment;
	}

	@Override
	public int hashCode() {
		return new Long(id).hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj instanceof Menu) {
			Menu that = (Menu) obj;
			return that.getName().equals(this.getName())
					&& that.getPid() == this.getPid();
		}
		return false;
	}
}